package com.shigui.news.quartz.job;

import java.io.IOException;


import javax.servlet.http.HttpServletResponse;

import org.apache.struts2.ServletActionContext;
import org.quartz.JobExecutionContext;
import org.quartz.JobExecutionException;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.scheduling.quartz.QuartzJobBean;


import com.shigui.news.model.News;
import com.shigui.news.service.CommentService;

/**
 * 
 * dingshirenwu
 * 
 * @author Administrator
 *
 */
public class UnLockJob extends QuartzJobBean {

	private static final Logger loggger = LoggerFactory.getLogger(UnLockJob.class);
	
	/**
	 * quartz-1.6.1-RC1.jar可能是版本较低的缘故，不支持自动注入
	 */
	private CommentService commentService;

	@Override
	protected void executeInternal(JobExecutionContext arg0)
			throws JobExecutionException {
//		HttpServletResponse httpResponse =  ServletActionContext.getResponse();
//		httpResponse.setCharacterEncoding("utf-8");
		loggger.info("--------开始解锁--------");
		
//		Integer count = commentService.countCommentsList(new News());
	
		loggger.info("--------完成解锁--------，总共");
		
//		HttpServletRequest request = ServletActionContext.getRequest();
//		
//		request.setAttribute(JsonFormat.RESPONSE_DATE_KEY, count);
//		
//		try {
//			
//			httpResponse.getWriter().println(count);
//			
//		} catch (IOException e) {
//			// TODO Auto-generated catch block
//			e.printStackTrace();
//		}
	}

	public CommentService getCommentService() {
		return commentService;
	}

	public void setCommentService(CommentService commentService) {
		this.commentService = commentService;
	}
	
	

}
